package com.ruoyi.config;

import io.minio.MinioClient;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: ES
 * @Date: 2022/8/13 17:51
 * @Description: MinIO配置
 **/
@Configuration(proxyBeanMethods = false)
@ConfigurationProperties(prefix = "minio")
@Data
public class MinIoConfig {

    private String accessKey;

    private String secretKey;

    private String url;

    private String bucketName;

    private String endPoint;

    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
                .endpoint(url)
                .credentials(accessKey, secretKey)
                .build();
    }

}
